<?php
/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
session_start();
require_once 'database/profile_handler.php';
require_once 'database/photo_handler.php';
require_once 'database/wall_handler.php';
require_once 'database/follower_handler.php';

$wall_id = $_GET['wallid'];
$count = $_GET['count'];
$div_id = $_GET['div_id'];
$comms = $_GET['comm'];
$body = $_GET['body'];
$UserTujuan = $_GET['UserTujuan'];
//echo "MAHO :". $comms;

$pf = new profile_handler();

$pf->get_nama_lengkap($_SESSION['Username']);
$nama = $pf->result[0];

$u = $_SESSION['Username'];

$ph = new photo_handler();

//ambil profpic id
$pf->retr_details($u, 4);
$id = $pf->result[0];

$wall = new wall_handler();
$wall->retr_post_byUsr($u);
$res = $wall->result;


                    $commentator = explode(';',$comms);
                    $comment_body = explode(';',$body);
//                    echo $commentator[0]. "<br/>";
//                    echo $commentator[1]. "<br/>";
//                    echo $commentator[2]. "<br/>";
//                    echo $commentator[3]. "<br/>";
                    for ($j = 3; $j < $count; $j++) {
                           // echo $commentator[$j]. "; BODY = ". $comment_body[$j]. "<br/>";
                            if (strlen($comment_body[$j]) > 0) {
                                $commentator_prof = new profile_handler();
                                $commentator_prof->retr_details($commentator[$j], 5);
                                $photo_handler = new photo_handler();
                                $photo_handler->get_url($commentator_prof->result[3][0]);
?>
                                <div id="wall_comment">
                                    <img id="image_commentator" src="<?php echo $photo_handler->result[0]; ?>" alt="" />
                                    <div id="name_commentator"><a id="link_name" href="otherprofile.php?UserTujuan=<?php echo $commentator[$j]; ?>">
<?php
                                echo $commentator_prof->result[4][0];
?>
                                </a>
                            </div>
                            <!-- disini kasih if biar di otherprofile gak tampil link buat ngedelete,
                            berarti nanti ada parameter tambahan yang dikirim dari fungsi ajax -->
                            
                            <div id="comment_delete">
                                <?php
                                if ($commentator[$j] == $_SESSION['Username']){
                                ?>
                                <a href="home.php?comment_wallid=<?php echo $wall_id; ?>&commentator=<?php echo $commentator[$j]; ?>&comment=<?php echo $comment_body[$j]; ?>">x</a>
                            
                            <?php
                                }
                                else echo "<br/>";
                            ?>
                            </div>
                            <div id="comment_content">
<?php
                                    // echo comment body
                                
                                    echo $comment_body[$j];
?>
                                </div>
                            </div>
<?php
                                }
                            
            }

?>
